package com.supermap.business.cloud.project;

import com.alibaba.dubbo.config.annotation.Reference;
import com.supermap.dataservice.util.JSONUtils;
import com.supermap.dubbo.api.cloud.project.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author aqua
 * @description
 * @date 2019年11月05 17:22
 * @email 1301584033@qq.com
 */
@CrossOrigin
@RequestMapping("/cloud/project")
@Controller
public class ProjectAllContrller {
    @Reference(timeout = 1000000)
    private ProjectService projectService;
    @GetMapping("/getUserParamList")
    @ResponseBody
    public JSONUtils getUserParamList(String areaParm,Integer projectId){
        return  projectService.getUserParamList(areaParm,projectId);
    }
    //项目查询
    @GetMapping("/getPageProjectList")
    @ResponseBody
     public JSONUtils getPageProjectList(String name,String userId ,Integer page, Integer size){
        return  projectService.getPageProjectList(name,userId,page,size);
     }
    //预算类型
    @GetMapping("/getExpendList")
    @ResponseBody
    public JSONUtils getExpendList(){
        return  projectService.getExpendList();
    }
    //项目添加
    @PutMapping("/putProject")
    @ResponseBody
    public JSONUtils putProject(@RequestBody Project project){
        return  projectService.putProject(project);
    }

    //删除项目
    @DeleteMapping("/delProject")
    @ResponseBody
    public JSONUtils delProject(Integer projectId){
        return  projectService.delProject(projectId);
    }

    //删除计划
    @DeleteMapping("/delProjectPlan")
    @ResponseBody
    public JSONUtils delProjectPlan(Integer PlanId){
        return  projectService.delProjectPlan(PlanId);
    }

    //修改项目
    @PostMapping("/postProject")
    @ResponseBody
    public JSONUtils postProject(@RequestBody Project project){
        return  projectService.postProject(project);
    }

    //修改项目计划
    @PostMapping("/postProjectPlan")
    @ResponseBody
    public JSONUtils postProjectPlan(@RequestBody ProjectPlan plan){
        return  projectService.postProjectPlan(plan);
    }

//-------------------------------------------------------------------------------------------

    //报销查看
    @GetMapping("/getPageProjectSubmitFileList")
    @ResponseBody
    public JSONUtils getPageProjectSubmitFileList(Integer projectId,String userId,Integer planid,String bDate,String eDate,String state,String stype,Integer page,Integer size){
        return  projectService.getPageProjectSubmitList(projectId, userId,planid,bDate,eDate,state,stype,page,size);
    }

    //上传
    @PostMapping("/postSubmitList")
    @ResponseBody
    public JSONUtils postSubmitList(@RequestBody SubmitFile submitFile){
        return  projectService.postSubmitList(submitFile);
    }

    //------------------------------------------------------------------------------------------

    //成果查询
    @GetMapping("/getPageProjectChengguoList")
    @ResponseBody
    public JSONUtils getPageProjectChengguoList(Integer projectId,Integer typeid,Integer page,Integer size){
        return  projectService.getPageProjectChengguoList(projectId,typeid,page,size);
    }

    //添加成果
    @PutMapping("/putAchievement")
    @ResponseBody
    public JSONUtils putAchievement(@RequestBody Achievement achievement){
        return  projectService.putAchievement(achievement);
    }
    //----------------------------------------------------------------------------------------------

    //区域作物查询
    @GetMapping("/getPageAreaCropList")
    @ResponseBody
    public JSONUtils getPageAreaCropList(String areaCode,String cropName,Integer yer,String xiangzheng,Integer page,Integer size){
        page=(page-1)*size;
        return  projectService.getPageAreaCropList(areaCode,cropName,yer,xiangzheng,page,size);
    }
    //区域上传
    //上传
    @PostMapping("/postAreaCrop")
    @ResponseBody
    public JSONUtils putAreaCrop(@RequestBody AreaCrop areaCrop){
        return  projectService.putAreaCrop(areaCrop);
    }
}
